//
//  BanBu_MagicView.m
// Halfarea
//
//  Created by Wangxj on 14-6-26.
//
//

#import "BanBu_MagicView.h"

@implementation BanBu_MagicView

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
        [self setUp];
    }
    return self;
}

-(void)setUp
{
    self.bgImage = [[[UIImageView alloc]initWithFrame:self.frame] autorelease];
    self.bgImage.backgroundColor = [UIColor clearColor];
    self.bgImage.image = [UIImage imageNamed:@"btn_magic_ materialBG.png"];
    
    [self addSubview:self.bgImage];
    
    self.imageView = [[[BanBu_MagicImageView alloc]init] autorelease];
    
    _imageView.layer.masksToBounds = YES;
    _imageView.layer.cornerRadius = 2;
    _imageView.backgroundColor = [UIColor clearColor];
    _imageView.userInteractionEnabled = YES;
    _imageView.frame = CGRectMake(1, 1, self.frame.size.width-2, self.frame.size.height-2);
    [self addSubview:_imageView];
}

-(void)setImageViewFrame:(BOOL)bl
{
    if (!bl)
    {
        self.bgImage.image = [UIImage imageNamed:@"btn_magic_ material_bigBG.png"];
    }
    CGRect frame = self.frame;
    frame.origin.x = 0;
    frame.origin.y = 0;
    self.bgImage.frame = frame;
    _imageView.frame = CGRectMake(4, 4, self.frame.size.width-8, self.frame.size.height-8);
}


@end
